package comc.service;

import comc.util.JWTUtil;
import org.springframework.stereotype.Component;

import java.io.UnsupportedEncodingException;
import java.util.HashMap;
import java.util.Map;

@Component
public class LoginService {
    public Map loginServiceImp(Map map){
        Map map2=new HashMap();
        String username = (String) map.get("username");
        try {
            String token = JWTUtil.createToken(username);
            map2.put("token",token);
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }
        map2.put("msg","生成的tolken");
        return map2;
    }
}
